import 'package:flutter/material.dart';
import 'package:jiajia_diy/pages/home_page.dart';
import 'package:jiajia_diy/pages/landing_page.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => new MyAppState();
}

class MyAppState extends State<MyApp> {
  bool _isThemeLight = true;

  _themeChanged(value) {
    setState(() {
      _isThemeLight = value;
    });
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: _isThemeLight
          ? ThemeData(
              brightness: Brightness.light,
              primaryColor: Color(0xFF5167a6),
              accentColor: Color(0xFF344a91),
            )
          : ThemeData(
              brightness: Brightness.dark,
              primaryColor: Color(0xFFdf694a),
              accentColor: Color(0xFFbc8876),
            ),
      title: 'A Studio For Jiajia',
      home: new Landing(),
      routes: <String, WidgetBuilder>{
        '/HomePage': (BuildContext context) =>
            new HomePage(isThemeLight: _isThemeLight, onChanged: _themeChanged)
      },
    );
  }
}
